package cn.sise.edu.crm.service.impl;

import cn.sise.edu.crm.domain.BuyRecord;
import cn.sise.edu.crm.mapper.BuyRecordMapper;
import cn.sise.edu.crm.query.QueryObject;
import cn.sise.edu.crm.service.IBuyRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by chen on 2019/11/3.
 */
@Service
public class BuyRecordServiceImpl implements IBuyRecordService {
    @Autowired
    private BuyRecordMapper buyRecordMapper;

    @Override
    public void insert(BuyRecord buyRecord) {
        buyRecordMapper.insert(buyRecord);
    }

    @Override
    public void delete(Long id) {
    }

    @Override
    public void update(BuyRecord buyRecord) {
    }

    @Override
    public BuyRecord selectById(Long id) {
        return buyRecordMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<BuyRecord> selectAll() {
        return buyRecordMapper.selectAll();
    }

    @Override
    public PageInfo<BuyRecord> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        return new PageInfo<>(buyRecordMapper.selectForList(qo));
    }
}
